home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: RETURN ();
- Date: 9 Feb 1996 12:14:07 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4ffdqf$cad@sparcserver.lrz-muenchen.de>
- References: <DMFxxq.7M7@emi.net> <4fe4m7$53m@mercury.dur.ac.uk>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- P D Johnson <P.D.Johnson@durham.ac.uk> writes:
-
- >: int Input_data()
- >: {
- >: x=5,y=30,z=10 /* These were gotten by asking questions */
- >: /* using printf / scanf/fgets (what ever) */
- >: /*point is they are gotten by question */
-
- >: return(x,y,z);
- >: }
-
- >Have you tried reading a book on C? You seem to have a lack of
- >understanding of how variables work in C. You can not even start to write
- >a program to do this until you have sorted out the basics of variables
- >and variable scope.
-
- >In your program you want to return several values. you can not use
- >return(x,y,z) as you cannot write x,y,z = get_input() in main() it makes
- >no sense to a C compiler(you might know what you mean).
-
- Have _you_ tried reading a book on C? You seem to have a lack of
- understanding of how _expressions_work in C.
-
- You can write
-
- {
- int x, y, z, get_input();
-
- x, y, z = get_input();
- }
-
- in main(), and in most other C functions, and it makes a lot of sense
- to a C compiler. In fact, it is a valid expression. It may not do
- what the original poster wants to do, but stating that it is not C
- is plain wrong.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-